package com.bw.kylin1705f.web;


import com.bw.kylin1705f.vo.ResultEntity;
import com.qpx.email.service.EmailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutorService;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Mht
 * @since 2019-12-05
 */
@RestController
@RequestMapping("/test")
@Slf4j
public class TestController {


    @Autowired
    EmailService emailService;


    @Autowired
    ExecutorService executorService;



    @RequestMapping(value = "/sendEmail",method = RequestMethod.GET)
    public ResultEntity sendEmail(){
        log.info("发送邮件开始.......");
        executorService.execute(()->{emailService.sendMail("测试spring-boot-starter-email","123456789-bw");});
        log.info("发送邮件结束.......");

        return ResultEntity.ok();
    }

}
